﻿@using Utils;
@model WebUI.Models.EmailTemplateListViewModel
@{
    ViewBag.Title = "EmailTemplate";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<div class="nav">
    <a href="@Url.Action("Index")">Admin Home</a>
</div>
<h2>Email Template List</h2>
<div class="clear"></div>
<div class="fr"><a href="@Url.Action("CreateEmailTemplate")">Create a New Email Template</a></div>
<div class="clear"></div>

<div class="adminSection etl">
    <div class="title">
        <div class="t t1">ID</div>
        <div class="t t2">Type</div>
        <div class="t t3">Name</div>
        <div class="t t4">Subject</div>
        <div class="t t5">Body</div>
        <div class="t t6">Parameter</div>
        <div class="t t7">Create</div>
        <div class="t t8">Modified</div>
        <div class="t t9">Edit/Del</div>
    </div>
    
    <div class="clear"></div>
    @foreach (var template in Model.EmailTemplateList)
    { 
        <div class="item">
            <div class="t t1">@template.EmailTemplateID</div>
            <div class="t t2">@template.EmailTemplateType</div>
            <div class="t t3">@template.EmailTemplateName</div>
            <div class="t t4">@template.Subject</div>
            <div class="t t5">@Html.Raw(template.Body.ToEmailHtml())</div>
            <div class="t t6">&nbsp;@template.BodyParameter</div>
            <div class="t t7">@template.CreateDate</div>
            <div class="t t8">@template.ModifiedDate</div>   
            <div class="t t9">
                &nbsp;<a href="@Url.Action("editEmailTemplate", new { emailTemplateID = template.EmailTemplateID})">Edit</a> 
                <a href="@Url.Action("deleteEmailTemplate", new { emailTemplateID = template.EmailTemplateID})">Delete</a>
            </div>     
            
        </div>
        <div class="smallspacer"></div>
        <div class="sp"></div>
        <div class="clear"></div>
    }
</div>

